// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_TemperatureSetpoint1_Cool.xml
    
    public class TemperatureSetpoint1_CoolService : MiosService
    {
        #region Application : String;
        private String _mApplication;
        
        public String Application
        {
            get
            {
                return _mApplication ?? GetApplication();
            }
        }
        
        #region Action SetApplication(String newApplication) : String;
        public String SetApplication(String newApplication)
        {
            if (String.IsNullOrEmpty(newApplication))
                throw new ArgumentNullException("newApplication");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetApplication",
                String.Format("NewApplication={0}", ToLuup(_mApplication = newApplication)));
        }
        #endregion Action SetApplication
        
        #region Action GetApplication() : String;
        public String GetApplication()
        {
            _mApplication = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Application"));
            
            return _mApplication;
        }
        #endregion Action GetApplication
        
        #endregion
        
        #region CurrentSetpoint : Int32;
        private Int32? _mCurrentSetpoint;
        
        public Int32 CurrentSetpoint
        {
            get
            {
                return _mCurrentSetpoint ?? GetCurrentSetpoint();
            }
        }
        
        #region Action SetCurrentSetpoint(Int32 newCurrentSetpoint) : String;
        public String SetCurrentSetpoint(Int32 newCurrentSetpoint)
        {
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetCurrentSetpoint",
                String.Format("NewCurrentSetpoint={0}", ToLuup(_mCurrentSetpoint = newCurrentSetpoint)));
        }
        #endregion Action SetCurrentSetpoint
        
        #region Action GetCurrentSetpoint() : Int32;
        public Int32 GetCurrentSetpoint()
        {
            _mCurrentSetpoint = FromLuupInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "CurrentSetpoint"));
            
            return _mCurrentSetpoint.Value;
        }
        #endregion Action GetCurrentSetpoint
        
        #endregion
        
        #region SetpointTarget : Int32;
        private Int32? _mSetpointTarget;
        
        public Int32 SetpointTarget
        {
            get
            {
                return _mSetpointTarget ?? GetSetpointTarget();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetSetpointTarget() : Int32;
        public Int32 GetSetpointTarget()
        {
            _mSetpointTarget = FromLuupInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "SetpointTarget"));
            
            return _mSetpointTarget.Value;
        }
        #endregion Action GetSetpointTarget
        
        #endregion
        
        #region SetpointAchieved : Boolean;
        private Boolean? _mSetpointAchieved;
        
        public Boolean SetpointAchieved
        {
            get
            {
                return _mSetpointAchieved ?? GetSetpointAchieved();
            }
        }
        
        #region Action GetSetpointAchieved() : Boolean;
        public Boolean GetSetpointAchieved()
        {
            _mSetpointAchieved = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "SetpointAchieved"));
            
            return _mSetpointAchieved.Value;
        }
        #endregion Action GetSetpointAchieved
        
        #endregion
        
        #region Name : String;
        private String _mName;
        
        public String Name
        {
            get
            {
                return _mName ?? GetName();
            }
        }
        
        #region Action SetName(String newName) : String;
        public String SetName(String newName)
        {
            if (String.IsNullOrEmpty(newName))
                throw new ArgumentNullException("newName");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetName",
                String.Format("NewName={0}", ToLuup(_mName = newName)));
        }
        #endregion Action SetName
        
        #region Action GetName() : String;
        public String GetName()
        {
            _mName = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Name"));
            
            return _mName;
        }
        #endregion Action GetName
        
        #endregion
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "Application":
                    _mApplication = FromLuupString(value); return true;
                case "CurrentSetpoint":
                    _mCurrentSetpoint = FromLuupInt32(value); return true;
                case "Name":
                    _mName = FromLuupString(value); return true;
                case "SetpointAchieved":
                    _mSetpointAchieved = FromLuupBoolean(value); return true;
                case "SetpointTarget":
                    _mSetpointTarget = FromLuupInt32(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public TemperatureSetpoint1_CoolService(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

